package com.framework.core.util;

import org.apache.poi.ss.usermodel.Cell;

/**
 * Created by fusf on 2016/6/22.
 */
public class POIUtil {

    /**
     * 获取单元格信息
     *
     * @param cell
     * @return
     */
    public static String getValue(Cell cell) {
        if (cell != null) {
            if (cell.getCellType() == cell.CELL_TYPE_BOOLEAN) {
                return String.valueOf(cell.getBooleanCellValue()).trim();
            } else if (cell.getCellType() == cell.CELL_TYPE_NUMERIC) {
                return String.valueOf(cell.getNumericCellValue()).trim();
            } else {
                return String.valueOf(cell.getStringCellValue()).trim();
            }
        } else {
            return "";
        }

    }
}
